<!--
 * @Author: your name
 * @Date: 2021-09-16 09:48:33
 * @LastEditTime: 2021-09-16 09:55:05
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\6-jQuery\day05\5-绘制视频.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绘制视频</title>
    <script>
        window.onload = function() {
            //获取标签
            var canvas = document.querySelector("canvas");
            var video = document.querySelector("video");
            //获取上下文
            var context = canvas.getContext("2d");
            //声明一个绘制视频方法
            draw();

            function draw() {
                context.drawImage(video, 0, 0, 200, 200);
                //请求动画帧
                requestAnimationFrame(draw);
            }
        }
    </script>
</head>

<body>
    <canvas width="400px" height="400px"></canvas>
    <video src="./音视频/1.mp4" width="400px" autoplay controls></video>
</body>

</html>